package subumbo.leg.view
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	
	import org.osflash.signals.Signal;
	
	import subumbo.leg.controller.signal.StateChangeSignal;
	import subumbo.leg.model.vo.ResizeVO;
	
	/**
	 * This is the abstract class for view components.
	 * @author pwolleb
	 */	
	
	public class ViewComponent extends Sprite implements IViewComponent {	
		
		protected var _stateChange:StateChangeSignal;
		
		public function show():void {	
		}
		
		public function hide():void {		
		}
		
		public function resize(resizeVO:ResizeVO):void {
		}
		
		public function fixedUpdate():void {
		}
		
		public function render(dt:Number):void {	
		}
		
		public function rasterize():Bitmap {
			var data:BitmapData = new BitmapData(width, height);
			data.draw(this);
			return new Bitmap(data);
		}
		
		public function destroy():void {
			_stateChange = null;
			graphics.clear();
		}
		
		protected function drawBoundingBox(color:int=0xFF0000):void {
			graphics.clear();
			graphics.beginFill(color, .3);
			graphics.drawRect(0,0,width,height);
		}
		
		public function set stateChangeSignal(val:StateChangeSignal):void {
			_stateChange = val;
		}
		
	}
}